In computer systems, a snapshot may be used to preserve a state of a system at a particular point in time. For example, before installing new software to the system, a snapshot may be generated for the system by creating a copy of the data in the system. If the new software installation encounters any problem, the copy of data provided by the snapshot may be used to restore the system back to its original state before the software installation. Once a snapshot is created, additional read/write operations may be recorded in a delta file (or a redo log). Once an initial snapshot is created for the system, subsequent snapshots may also be created for the system to preserve additional states of the system.
In a virtual machine (VM), its virtual storage may be implemented using a single “virtual storage file”, and a snapshot of the virtual storage may be created in a form of a “snapshot file.” Conventionally, after a snapshot is created, the size of its snapshot file may increase throughout time, as more and more data updates may be recorded in this snapshot file. A large snapshot file may affect the overall performance of the system, as each data read or data write may require the access of the snapshot file and the virtual storage file. Thus, when a snapshot file becomes too big, a conventional “collapsing” operation may be invoked to merge the snapshot file into the virtual storage file. Since the conventional collapsing operation needs apply the updates stored in the snapshot file to the virtual storage file, it requires a large disk space allocation, often takes a long time to finish, and is expensive in terms of CPU and storage resources.